import { getRdsUrl, rdsRequest } from '@/hooks/rdsServices';
import service from '../common/service';


// 获取RDS单据类型
const useBillType = async () => {
  const rdsUrl = getRdsUrl();
  let billTypes = service.getLocalStorage('rdsBillTypes') || [];
  if (billTypes.length == 0) {
    service.enjoyShowLoading('正在加载单据类型...');
    const res = await rdsRequest(rdsUrl.bcApi, 'Rds公共服务', 'GetAllBillTypes');
    billTypes = res;
    service.addlocalStorage('rdsBillTypes', res);
    service.enjoyHideLoading();
  }
  return {billTypes};
};


export default useBillType;
